<template>
  <div class="top">
    <div class="top_box">
      <div class="item">
        <span v-if="isLogIn">
            欢迎来到数码商城！{{ username }}
            <a @click="userLogOut" href="#"> 退出登录 </a>
        </span>
        <span v-else>欢迎来到数码商城！请先
            <a @click="userLogIn" href="#"> 登录 </a>|
            <a @click="userLogIn" href="#"> 注册 </a>
        </span>
      </div>
      <!-- 后面每一个都要进行路由跳转 -->
      <div class="item">
        <router-link to="/home">商城首页</router-link>
      </div>
      <div class="item">
        <router-link to="/user">我的订单</router-link>
      </div>
      <div class="item">
        <router-link to="/user">个人中心</router-link>
      </div>
      <div class="item">
        <router-link to="/user">我的收藏</router-link>
      </div>
      <div class="item">
        <a href="#">卖家后台</a>
      </div>
      <div class="item">
        <a href="#">关于我们</a>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: "xcccc",
      isLogIn:false,
    };
  },
    methods:{
        userLogIn(){
            this.isLogIn=true
        },
        userLogOut(){
            this.isLogIn=false
        }
    }
};
</script>



<style lang="scss" scoped>
@import '@/assets/style/variables.scss'; 
.top {
  width: 100%;
  color: #999;
  background-color: #f6f6f6; 
  .top_box {
    width: 70%;
    height: 36px;
    margin: auto;
    display: flex;
    line-height: 15px;
    font-size: 15px;
    align-items: center;
    justify-content: flex-end;
    .item {
      width: 90px;
      height: 15px;
      border-left: 1px solid rgb(0, 0, 0);
      text-align: center;
    }
    .item:first-child {
      flex: 1;
      border-left: none;
      width: auto;
      margin-right:30px;
      text-align: left;
    }
  }
  a{
      color: $dark-green;
  }
}
</style>